<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="UTF-8" />
    <title>Modal - Inline</title>
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
    />
    <link href="../../../../../css/ionic.bundle.css" rel="stylesheet" />
    <link href="../../../../../scripts/testing/styles.css" rel="stylesheet" />
    <script src="../../../../../scripts/testing/scripts.js"></script>
    <script type="module" src="../../../../../dist/ionic/ionic.esm.js"></script>
  </head>
  <body>
    <ion-app>
      <div class="ion-page">
        <ion-header>
          <ion-toolbar>
            <ion-title>Modal - Inline</ion-title>
          </ion-toolbar>
        </ion-header>

        <ion-content class="ion-padding">
          <ion-button onclick="openModal(event)">Open Modal</ion-button>

          <ion-modal swipe-to-close="true">
            <ion-header>
              <ion-toolbar>
                <ion-title> Modal </ion-title>
              </ion-toolbar>
            </ion-header>
            <ion-content class="ion-padding"> This is my inline modal content! </ion-content>
          </ion-modal>
        </ion-content>
      </div>
    </ion-app>

    <script>
      const modal = document.querySelector('ion-modal');
      modal.presentingElement = document.querySelector('.ion-page');

      const openModal = () => {
        modal.isOpen = true;
      };

      modal.addEventListener('didDismiss', () => {
        modal.isOpen = false;
      });
    </script>
  </body>
</html>
